<%--
 *  File:    HospitalSummaryForPop.jsp
 *  @Author: banshang
 *  Date:    2010/07/07
 *
 *  Copyright (C) 2000 - 2010 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.SelectCheckbox"); 

  //init param
  String strModuleName = "ERM";
  String privilegeCode = "all";
  String contextPath = request.getContextPath();
%>
<% //--------------------------------------  include files list --%>
<%@ include file="/inc/FrmDefault.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>

<html>
<head>
<title>SelectCheckbox</title>
<PageFlow:CheckPageFlow pageName="p_zylselectcheckbox"/>
<link rel="stylesheet" href="<%=contextPath %>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath %>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath %>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>
<script>

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('values');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = true;
		}
	}else{
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = false;
		}	
	}
}

function closeWindow(flag){
	if(flag != 1 ){
		var alldatafile = document.getElementsByName('values');
		var length = alldatafile.length;
		var str="";
		for(var i = 1 ; i <= length;i++){
			if(alldatafile[i-1].checked == true){str = str + alldatafile[i-1].value + ","};
		}
		str = str.substr(0,str.length-1);
		opener.page_setStr(str);
	}
	window.close();
}
</script>
</head>
<body>
<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
<form name="cform" method="post" action="<%=contextPath %>/Dispatcher"  target="_self">
	<input type="hidden" name="pagename" value="p_zylselectcheckbox">
	<input type="hidden" name="actionname">
	<custom:hidden property="status"/>
    <td> 
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
         <%
             int i = 0;
             String strClassType = new String(); 
             Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
             String dictype = (String)pageContext.getAttribute("dictype");
             String flag = (String)pageContext.getAttribute("flag");
             if(totalsummary == null) totalsummary = new Vector();
          %>
         <tr  class="deepblue-left"> 
            <%if(dictype!=null){ %>
            <td width="4%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
            <%} %>
            <%if("1".equals(flag)){ %>
            <td width="*" class="title_center"><%= label.getLabelName("L_ComplaintReason") %></td>
            <%}else{ %>
            <td width="*" class="title_center"><%= label.getLabelName("L_ExpertType") %></td>
            <%} %>
         </tr>
          <%if(dictype!=null){ %>
          <logic:iterate id="summary" collection="<%= totalsummary %>">                      
          <%
            HashMap summaryMap = (HashMap)pageContext.getAttribute("summary");
            if(summaryMap == null) summaryMap = new HashMap();
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
            i++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
            <td>
              <input id="values<%=JspHelper.filterNull(i)%>" name="values" type="checkbox" value="<custom:write name="summary" property="valuename"/>" class="normalradio">
            </td>
            <td><custom:write property="valuename" name="summary"/></td>
          </tr>
          </logic:iterate>
          <%}else{ %>
          <logic:iterate id="summary" collection="<%= totalsummary %>">                      
          <%
            String summaryStr = (String)pageContext.getAttribute("summary");
            if(i%2 == 1){
              strClassType = "td-listrom";             
            }else{                    
              strClassType = "";
            }
            i++;     
          %>
           <tr onmouseover="this.className='tr-over'" onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'" class="<%=JspHelper.filterNull(strClassType)%>">
            <td><custom:write property="summary"/></td>
          </tr>
          </logic:iterate>
          <%} %>
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
            <%if(dictype!=null){ %>
            <a onclick="closeWindow()"><custom:button type="1" label="L_Ok" imgsrc="delete.gif" border="0" style="width:60"/></a>
            <%}else{ %>
            <a onclick="closeWindow(1)"><custom:button type="1" label="L_Ok" imgsrc="delete.gif" border="0" style="width:60"/></a>
            <%} %>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  </form>
</table>
</body>
</html>